package com.example.afinal;

import android.view.View;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.ArrayList;
import java.util.List;

public class MyPageAdapter extends FragmentPagerAdapter {

    private List<Fragment> fms= new ArrayList<Fragment>() {{
        add(new VoiceListActivity());
        add(new CardActivity());
        add(new NotesListActivity());
        add(new MyActivity());
    }};

    public MyPageAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public int getCount() {
        return fms.size();
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return fms.get(position);
    }

    @Override
    public boolean isViewFromObject(@NonNull View view, @NonNull Object object) {
        return ((Fragment)object).getView() == view;
    }
}
